function formatTime (time) {
  if (typeof time !== 'number' || time < 0) {
    return time
  }

  var hour = parseInt(time / 3600)
  time = time % 3600
  var minute = parseInt(time / 60)
  time = time % 60
  var second = time

  return ([hour, minute, second]).map(function (n) {
    n = n.toString()
    return n[1] ? n : '0' + n
  }).join(':')
}

function formatLocation (longitude, latitude) {
  if (typeof longitude === 'string' && typeof latitude === 'string') {
    longitude = parseFloat(longitude)
    latitude = parseFloat(latitude)
  }

  longitude = longitude.toFixed(2)
  latitude = latitude.toFixed(2)

  return {
    longitude: longitude.toString().split('.'),
    latitude: latitude.toString().split('.')
  }
}
//过滤表情
function isEmojiCharacter (substring) {
  for (var i = 0; i < substring.length; i++) {
    var hs = substring.charCodeAt(i);
    if (0xd800 <= hs && hs <= 0xdbff) {
      if (substring.length > 1) {
        var ls = substring.charCodeAt(i + 1);
        var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
        if (0x1d000 <= uc && uc <= 0x1f77f) {
          return true;
        }
      }
    } else if (substring.length > 1) {
      var ls = substring.charCodeAt(i + 1);
      if (ls == 0x20e3) {
        return true;
      }
    } else {
      if (0x2100 <= hs && hs <= 0x27ff) {
        return true;
      } else if (0x2B05 <= hs && hs <= 0x2b07) {
        return true;
      } else if (0x2934 <= hs && hs <= 0x2935) {
        return true;
      } else if (0x3297 <= hs && hs <= 0x3299) {
        return true;
      } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 ||
        hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b ||
        hs == 0x2b50) {
        return true;
      }
    }
  }
}
// 限制输入字母数字汉字,下划线中英文括号
function checkNormalName (name) {
  let reg = /^[\u4e00-\u9fa5A-Za-z0-9_（）()、\\【】[\]/]+$/
  if (reg.test(name)) {
    return true
  } else {
    return false
  }
}
// 订阅消息授权相关
let messageAuth = {
	tmplIdsConfig: {
		INTEGRAL: ['lrhbYJ8m-Gc2qOcyJaKvXCAJ5NQG2SqiR_TuqTtqTwU'], // 进入我积分页，['积分奖励提醒']
		CARD_ORDER_PAY_SUCCESS: ['2q1CSS6lk9zL-UtVk69QSTtTN5WduXJceW8i78fWwE4','H5UNyxtbikiqoNpj4cbADLYpxICSDT-Ea9sNkN8XNOc'], // 打球卡订单支付成功,['会员开卡提醒','余额不足通知']
		ACT_ORDER_HOUBU_SUCCESS: ['WCend1bHhqe55vSUdojvwOK7rT1Lw59P9gujozz5dDU','a-ZXlN3ULiRVShJdwUC8cNqWp6IobN7COG-KuZ3b6d4','8c_ah3V4iLzibclzyPq39-Dr03PG69zRpo8AHTCvtzg'], // 活动订单候补报名成功,['新订单通知','活动参与结果通知','退款通知']
		ACT_ORDER_SUCCESS: ['WCend1bHhqe55vSUdojvwOK7rT1Lw59P9gujozz5dDU','a-ZXlN3ULiRVShJdwUC8cNqWp6IobN7COG-KuZ3b6d4','8c_ah3V4iLzibclzyPq39-Dr03PG69zRpo8AHTCvtzg'], // 活动订单正式报名成功,['新订单通知',,'活动参与结果通知','退款通知']
		SUBMIT_REFUND_REQUEST: ['8c_ah3V4iLzibclzyPq398Ku2UzagW4EOdiWZCyyXDE'], // 用户提交退款申请,['退款通知']
		COMFIRM_REFUND_REQUEST: ['8c_ah3V4iLzibclzyPq398Ku2UzagW4EOdiWZCyyXDE'], // 用户确认退款申请,['退款通知']
		SHORT_COURSE_PAY_SUCCESS: ['G25IdEAnakXl-08nZG-Il0vvMPSI2t-z9rrNqhC18T4','fIo-REQ0GWhacoN1SmSyVm-jH4W30qkWxGl1emm7kfo'], // 短课订单付款成功,['课程确认提醒','评价提醒']
		APPOINT_SUCCESS: ['G25IdEAnakXl-08nZG-Il0vvMPSI2t-z9rrNqhC18T4','9bdLMyKtBJh2819NPweibJRPpdKKUDnt5HlwiqHuXP0','fIo-REQ0GWhacoN1SmSyVm-jH4W30qkWxGl1emm7kfo'], // 用户约课成功,['课程确认提醒','课程开课提醒','评价提醒']
		LONG_COURSE_PAY_SUCCESS: ['drcaDUsHpDBRymv-x8dDkcFx0LrIib9DqmZLZYidYR8','kydFzAfFkcj7Fxxlz2F3iTydXcOJ990kiqRj-hrHGHQ','G25IdEAnakXl-08nZG-IlzyGcbIc-qqzytz3fM_XSdo'], // 长课订单付款成功,['课程预约成功通知','课程到期通知','课程确认提醒']
	},
	requestAuth (key,callBack) { // 调起授权
		let _this = this
		uni.getSetting({
			withSubscriptions: true,  
			success:(res)=>{
				console.log('getSetting', res)
				uni.requestSubscribeMessage({
					tmplIds: _this.tmplIdsConfig[key],
					success: (result)=>{
						console.log('requestSubscribeMessage',result)
						if(callBack){
							callBack()
						}
					},
					fail:(error)=>{
						console.log('requestSubscribeMessage err', error)
						if(callBack){
							callBack()
						}
					}
				})
			},
			fail:(err)=>{
				console.log('getSetting err', err)
			}
		})
	}
}
var dateUtils = {
  UNITS: {
    '年': 31557600000,
    '月': 2629800000,
    '天': 86400000,
    '小时': 3600000,
    '分钟': 60000,
    '秒': 1000
  },
  humanize: function (milliseconds) {
    var humanize = '';
    for (var key in this.UNITS) {
      if (milliseconds >= this.UNITS[key]) {
        humanize = Math.floor(milliseconds / this.UNITS[key]) + key + '前';
        break;
      }
    }
    return humanize || '刚刚';
  },
  format: function (dateStr) {
    var date = this.parse(dateStr)
    var diff = Date.now() - date.getTime();
    if (diff < this.UNITS['天']) {
      return this.humanize(diff);
    }
    var _format = function (number) {
      return (number < 10 ? ('0' + number) : number);
    };
    return date.getFullYear() + '/' + _format(date.getMonth() + 1) + '/' + _format(date.getDate()) + '-' +
      _format(date.getHours()) + ':' + _format(date.getMinutes());
  },
  parse: function (str) { //将"yyyy-mm-dd HH:MM:ss"格式的字符串，转化为一个Date对象
    var a = str.split(/[^0-9]/);
    return new Date(a[0], a[1] - 1, a[2], a[3], a[4], a[5]);
  },
  stampFormat: function (stamp, type) { //将时间戳转化为"yyyy-mm-dd"格式的字符串
    const _format = function (number) {
      return (number < 10 ? ('0' + number) : number)
    }
    const date = new Date(stamp)
    let str = '-'
    if (type == 2) {
      str = '.'
    } else if (type == 1) {
      str = '/'
    }
    return date.getFullYear() + str + _format(date.getMonth() + 1) + str + _format(date.getDate())
  },
  stampFormatLong: function (stamp, type) { //将时间戳转化为"yyyy-mm-dd hh:mm:ss"格式的字符串
    const _format = function (number) {
      return (number < 10 ? ('0' + number) : number)
    }
    const date = new Date(stamp)
    let str = '-'
    if (type == 2) {
      str = '.'
    } else if (type == 1) {
      str = '/'
    }
    return date.getFullYear() + str + _format(date.getMonth() + 1) + str + _format(date.getDate()) + ' ' +
      _format(date.getHours()) + ':' + _format(date.getMinutes()) + ':' + _format(date.getSeconds())
  },
  formatSecond: function (second) {
    const days = Math.floor(second / 86400);
    const hours = Math.floor((second % 86400) / 3600);
    const minutes = Math.floor(((second % 86400) % 3600) / 60);
    const seconds = Math.floor(((second % 86400) % 3600) % 60);
    const forMatDate = {
      days: days,
      hours: hours,
      minutes: minutes,
      seconds: seconds
    };
    return forMatDate;
  }
};

const objUtils = {
  getClass: function (o) { //判断数据类型
    return Object.prototype.toString.call(o).slice(8, -1)
  },
  deepCopy: function (obj) { //对象深拷贝
    let result, oClass = this.getClass(obj)
    if (oClass == "Object") result = {} //判断传入的如果是对象，继续遍历
    else if (oClass == "Array") result = [] //判断传入的如果是数组，继续遍历
    else return obj //如果是基本数据类型就直接返回
    for (let i in obj) {
      let copy = obj[i]
      if (this.getClass(copy) == "Object") result[i] = this.deepCopy(
        copy) //递归方法 ，如果对象继续变量obj[i],下一级还是对象，就obj[i][i]
      else if (this.getClass(copy) == "Array") result[i] = this.deepCopy(
        copy) //递归方法 ，如果对象继续数组obj[i],下一级还是数组，就obj[i][i]
      else result[i] = copy; //基本数据类型则赋值给属性
    }
    return result
  }
}

const strUtils = {
  round: (digit, length) => { // 四舍五入截取一个小数
    length = length ? parseInt(length) : 0
    if (length <= 0) return Math.round(digit)
    digit = Math.round(digit * Math.pow(10, length)) / Math.pow(10, length)
    return digit
  },
  trim: (str = '') => {
    return trim(str)
  },
	/**
	 * 验证电话号码 （包括手机号）
	 */
  isPhoneNum: (str) => {
    if (!str) {
      return false
    }
    // eslint-disable-next-line no-useless-escape
    return str.match(/^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/) !== null || str.match(
      /^1\d{10}$/) !== null
  },
	/**
	 * 手机号码
	 */
  isMobilePhoneNum: (str) => {
    if (!str) {
      return false
    }
    return (/^1[3456789]\d{9}$/.test(str))
  },
  isEmail: (str) => {
    if (!str) {
      return false
    }
    // eslint-disable-next-line no-useless-escape
    return str.match(/^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/g) !== null
  },
  isUserID: (str) => {
    if (!str) {
      return false
    }
    return (/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(str))
  },
  // 判断输入的字符是否为:a-z,A-Z,0-9
  isString: (str) => {
    if (!str) {
      return false
    }
    let regExp = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,21}$/
    str = str.trim()
    return (str.length !== 0) ? regExp.test(str) : false
  },
  // 字母和数字组合
  isStringNum: (str) => {
    if (!str) {
      return false
    }
    str = str.trim()
    return (str.length !== 0) ? (/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/).test(str) : false
  },
  isNum: (str) => {
    if (!str) {
      return false
    }
    return str.replace(/\d+/, '') === ''
  },
  jsonToStr: (json) => {
    return encodeURI(JSON.stringify(json))
  },
  strToJson: (str) => {
    if (str === null || str === '' || str === undefined) {
      return null
    }
    str = decodeURI(str)
    return JSON.parse(str)
  },
  // 隐藏部分手机号
  hidePhone: (phoneNum) => {
    phoneNum = phoneNum.toString().replace(/\s*/g, '')
    return phoneNum === '' ? '' : phoneNum.replace(/(\d{3})\d{1,5}(\d{3})/g, '$1*****$2')
  },
  // 隐藏部分名字
  hideUserName: (str) => {
    str = str.toString().replace(/\s*/g, '')
    let len = str.length - 1 - 1
    if (len === -1) {
      return str
    } else if (str.length === 1) {
      return str.substring(0, 1) + '*'
    } else {
      let xing = ''
      for (let i = 0; i < len; i++) {
        xing += '*'
      }
      return str.substring(0, 1) + xing + str.substring(str.length - 1)
    }
  },
  // 千位符+保留两位小数
  fMoney: (s, n = 2) => {
    s = s || ''
    if (isNaN(s)) return '0.00'
    if (s === '' || s === 0) return '0.00'
    let flag = ''
    if (s < 0) {
      flag = '-'
      s = s.toString().split('-')[1]
    }

    n = (n > 0 && n <= 20) ? n : 2
    // eslint-disable-next-line no-useless-escape
    s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + ''

    let [l, r, t] = [s.split('.')[0].split('').reverse(), s.split('.')[1], '']
    if (!r) return s + '.00'
    for (let i = 0; i < l.length; i++) {
      t += l[i] + ((i + 1) % 3 === 0 && (i + 1) !== l.length ? ',' : '')
    }
    return flag + t.split('').reverse().join('') + '.' + r
  },
  filterEmoji: (str) => {
    let newStr = ''
    let is4Byte = function (str) {
      return str.codePointAt(0) > 65535
    }
    for (let item of str) {
      if (!is4Byte(item)) {
        newStr += item
      }
    }
    return newStr
  }
}
const rili = {
  /*获取一个月的天数 */
  getCountDays: function (date, y, m, d) {
    var curDate = new Date(y + '/' + m + '/1');
    curDate.setMonth(m);
    curDate.setDate(0);
    return curDate.getDate();
  },
  getEveryDay: function (date) { //获取每一天
    let dates = date.split('-');
    let y = dates[0];
    let m = dates[1];
    let d = dates[2];
    var dayArry = [];
    var day = this.getCountDays(date, y, m, d);
    for (var k = 1; k <= day; k++) {
      let s = '';
      if (k < 10) {
        s = '0' + k
      } else {
        s = k
      }
      dayArry.push({
        date: y + '-' + m + '-' + s,
        week: this.getweekDay(y + '/' + m + '/' + k)
      });
    }
    return dayArry;
  },
  getweekDay: function (days) { //获取星期
    let date = new Date(days);
    return date.getDay();
  },
  zhuannums: function (time) { //转时间戳
    if (time) {
      let time1 = time.replace(/-/g, '/')
      let dates = new Date(time1);
      return Date.parse(dates);
    } else {
      let dates = new Date();
      return Date.parse(dates);
    }
  },
  bijiao: function (a, b, text) { //比较日期
    //a日历日期，b接口返回的列表
    let _t = this;
    let linshi = [];
    for (var i = 0; i < a.length; i++) {
      // a[i].data=[];
      for (var j = 0; j < b.length; j++) {
        let liwaidate = '';
        if (b[j].exception.length > 0) {
          for (var y = 0; y < b[j].exception.length; y++) {
            liwaidate += (b[j].exception[y].exDate + ',')
          }
        }
        if (b[j].type == '0' || b[j].type == '1') {
          //长期课 日常活动

          //当前时间，大于开始时间，小于结束时间
          if (_t.zhuannums(a[i].date) >= _t.zhuannums(b[j].classStart) && _t.zhuannums(a[i].date) <=
            _t.zhuannums(b[j].classEnd) ||
            _t.zhuannums(a[i].date) >= _t.zhuannums(b[j].startDate) && _t.zhuannums(a[i].date) <= _t
              .zhuannums(b[j].endDate)
          ) {
            //是否是例外日期
            if (liwaidate.indexOf(a[i].date) == -1) {
              // a[i].data.push(b[j])
              linshi.push({
                date: a[i].date
              })
            }
          }
        } else if (b[j].type == '2') {
          //短期课 赛事活动
          if (_t.zhuannums(a[i].date) >= _t.zhuannums(b[j].classStart) && _t.zhuannums(a[i].date) <=
            _t.zhuannums(b[j].classEnd) ||
            _t.zhuannums(a[i].date) >= _t.zhuannums(b[j].startDate) && _t.zhuannums(a[i].date) <= _t
              .zhuannums(b[j].endDate)
          ) {
            if (liwaidate.indexOf(a[i].date) == -1) {
              // a[i].data.push(b[j])
              linshi.push({
                date: a[i].date
              })
            }
          }
        }
      }
    }
    let object = {}
    let linshi1 = linshi.reduce((item, next) => {
      object[next.date] ? "" : object[next.date] = true && item.push(next);
      return item;
    }, []);
    return linshi1;
  },
  jktolb: function (arr) { //接口转列表数据
    let _this = this;
    let data_ = [];
    let time = [];
    for (var i = 0; i < arr.length; i++) {
      let week = arr[i].week.split(',');
      for (var j = 0; j < week.length; j++) {
        let time = [];
        time.push(arr[i].startTime.slice(0, 5) + '-' + arr[i].endTime.slice(0, 5))
        data_.push({
          week: _this.weeknames(week[j]),
          time: time,
          weeknum: week[j]
        })
      }
    }
    let data1 = []
    data1 = _this.union(data_, 'week')
    data1.sort(function (a, b) {
      var value1 = a['weeknum'];
      var value2 = b['weeknum'];
      return value1 - value2; //升序,降序为value2 - value1
    })
    return data1;
  },
  jktolbDetail: function (arr) {//接口转列表数据
    let _this = this;
    let data_ = [];
    let time = [];
    var newArr = []
    arr = arr.map((item) => {
      item.week.split(',').map((item1) => {
        if (newArr.indexOf(item1) == -1) {
          newArr.push(item1)
        }
      });
      return item

    })
    var arrr = []
    newArr.map((item) => {
      var obj = {
        week: _this.weeknames(item), time: [], weeknum: item
      }
      arr.map((item1) => {
        if (item1.week.split(',').indexOf(item) > -1) {
          obj.time.push({ setTime: item1.startTime.slice(0, 5) + '-' + item1.endTime.slice(0, 5), peo: item1.numbers })
        }
      });
      arrr.push(obj)
      return item
    })
    data_ = arrr
    let data1 = []
    data1 = this.union(data_, 'week')
    this.lbData = data1;
    data1.sort(function (a, b) {
      var value1 = a['weeknum'];
      var value2 = b['weeknum'];
      return value1 - value2;//升序,降序为value2 - value1
    })
    //下面是处理不齐数据，样式线条
    let num = 0;
    for (let i = 0; i < data1.length; i++) {
      if (data1[i].time.length > num) {
        num = data1[i].time.length
      }
    }
    for (let i = 0; i < data1.length; i++) {
      data1[i].time.length = num
    }
    return data1;
  },
  union: function (arr, text) { //处理数据
    arr = arr || []
    var tmp = {}
    for (var i = 0, len = arr.length; i < len; i++) {
      var obj = arr[i]
      if (text == 'week') {
        if (obj.week in tmp) {
          tmp[obj.week].time.push(obj.time.join())
        } else {
          tmp[obj.week] = obj
        }
      } else { //处理为前端数据
        if (obj.group in tmp) {
          delete tmp[obj.group].startTime;
          delete tmp[obj.group].endTime;
          tmp[obj.group].time.push({
            startTime: obj.startTime,
            endTime: obj.endTime
          })
        } else {
          delete obj.startTime;
          delete obj.endTime;
          tmp[obj.group] = obj
        }
      }

    }
    var result = []
    for (var key in tmp) {
      result.push(tmp[key])
    }
    return result
  },
  configjk (arr) {
    arr.sort(function (a, b) {
      var value1 = a['cost'];
      var value2 = b['cost'];
      return value1 - value2;//升序,降序为value2 - value1
    })
    let arrr = []
    let arr1 = []
    let arr2 = []
    let allArr = []
    arr.map((item, i) => {
      arr1.push(item.classCount == "99999" ? "不限" : item.classCount)
      arr2.push(item.cost)
      arrr.push(item.classDays)
      return item
    })
    allArr = [
      {
        classCount: arr1,
      }, {
        classCount: arr2,
      }, {
        classCount: arrr,
      }
    ]
    let data1 = allArr
    return data1
  },
  shortjkdata (arr1) {
    //短期时间前端数据转接口数据
    let _this = this;
    let arr = arr1;
    let time = arr1.time;
    //排列从早到晚
    time.sort(function (a, b) {
      return a.startTime.localeCompare(b.startTime)
    })
    let data_ = [];
    for (var i = 0; i < time.length; i++) {
      data_.push({
        week: '',
        startTime: time[i].startTime,
        endTime: time[i].endTime,
        group: 1
      })
    }
    return data_;
  },
  shortqddata (arr) {
    //短期时间段接口数据转前端数据
    let data = [];
    for (var i = 0; i < arr.length; i++) {
      data.push({
        startTime: arr[i].startTime.slice(0, 5),
        endTime: arr[i].endTime.slice(0, 5)
      })
    }
    return data;
  },
  weeknames (a) {
    let text = '';
    switch (a) {
      case '1':
        text = '周一';
        break;
      case '2':
        text = '周二';
        break;
      case '3':
        text = '周三';
        break;
      case '4':
        text = '周四';
        break;
      case '5':
        text = '周五';
        break;
      case '6':
        text = '周六';
        break;
      case '7':
        text = '周日';
        break;
    }
    return text;
  },
  //以下为标点用的方法
  //短期课选中的日期
  shortdate (start, end, exception, text) {
    //课程开始结束日期、列外日期数组、text=hui//有会点，不传不要灰点去掉那天
    var date_all = [],
      i = 0,
      uniCalSelArr = [];
    var startTime = getDate(start);
    var endTime = getDate(end);
    while ((endTime.getTime() - startTime.getTime()) >= 0) {
      var year = startTime.getFullYear();
      var month = (
        startTime.getMonth() + 1).toString().length == 1 ?
        "0" + (startTime.getMonth() + 1).toString() :
        (startTime.getMonth() + 1).toString();
      var day = startTime.getDate().toString().length == 1 ?
        "0" + startTime.getDate() :
        startTime.getDate();
      date_all[i] = year + "-" + month + "-" + day;
      startTime.setDate(startTime.getDate() + 1);
      i += 1;
    }

    function getDate (datestr) {
      var temp = datestr.split("-");
      return new Date(temp[0], temp[1] - 1, temp[2]);
    }
    //'●'
    date_all.map((v, index) => {
      uniCalSelArr.push({
        date: v,
        info: '',
      })
    })
    return this.liwaidata(uniCalSelArr, exception, text);


  },
  liwaidata (arr, exarr, text) { //列外日期赋值
    let allarr = arr;
    let exception = exarr;
    let newall = [];
    if (exception.length) {
      exception.map((v, index) => {
        allarr.map((s, i) => {
          if (v.exDate == s.date) {
            s.info = ' '
          }
        })
      })
    }
    if (text !== 'hui') {
      for (var i = 0; i < allarr.length; i++) {
        if (allarr[i].info == '') {
          newall.push(allarr[i])
        }
      }
      return newall
    } else {
      return allarr;
    }
  },
  // 课程日历初始化
  courseCalendarInit (start, end, lbdata, linshidata, text) {
    let testJson = [{
      stime: '',
      etime: '',
      week: []
    }]
    testJson[0].stime = start;
    if (end == '') {
      testJson[0].etime = this.getTargetDate(linshidata.baomingjs.value.replace(/-/g, '/'), linshidata
        .youxiaoqi)
    } else {
      testJson[0].etime = end
    }
    let week_ = [];
    lbdata.map((v) => {
      week_.push({
        w: v.weeknum == '7' ? '0' : v.weeknum
      })
    })
    testJson[0].week = week_;
    let dotsArr = [];
    let uniCalSelArr = [];
    testJson.forEach((item, index) => {
      dotsArr.push(...this.matchDates(item))
    })
    let stampDotsArr = [...new Set(dotsArr)].sort((a, b) => a - b)
    stampDotsArr.forEach((item, index) => {
      uniCalSelArr.push({
        date: dateUtils.stampFormat(item),
        info: ''
      })
    })
    return this.liwaidata(uniCalSelArr, linshidata.exception, text);
  },
  // 返回一个课程内上课时间
  matchDates (obj) {
    let weeksArr = new Array
    obj.week.forEach((item, index) => [
      weeksArr.push(Number(item.w))
    ])
    let oneDay = 86400000
    let [sTime, eTime] = [new Date(obj.stime.replace(/-/g, '/')), new Date(obj.etime.replace(/-/g, '/'))]
    let days = (eTime - sTime) / oneDay
    let dotArr = []
    let curTime = sTime.getTime()
    if (weeksArr.includes(new Date(curTime).getDay())) {
      dotArr.push(curTime)
    }
    for (let i = 0; i < days; i++) {
      curTime += oneDay
      if (weeksArr.includes(new Date(curTime).getDay())) {
        dotArr.push(curTime)
      }
      // curTime += oneDay
    }
    return dotArr
  },
  getTargetDate (startDate, days) {
    //获取多少天以后的日期
    var startTime = new Date(startDate).getTime();
    var diff = days * 86400 * 1000;
    var endTime = startTime + diff;
    var d = new Date(endTime);
    var CurrentDate = "";
    CurrentDate += (d.getFullYear());
    if ((d.getMonth() + 1) > 9) {
      CurrentDate += "-" + (d.getMonth() + 1);
    } else {
      CurrentDate += "-0" + (d.getMonth() + 1);
    }
    if ((d.getDate()) > 9) {
      CurrentDate += "-" + (d.getDate());
    } else {
      CurrentDate += "-0" + (d.getDate());
    }
    return CurrentDate;
  },
}

function positionXY (p1, p2) {
  let radLat1 = p1.lat * Math.PI / 180.0
  let radLat2 = p2.lat * Math.PI / 180.0
  let a = radLat1 - radLat2
  let b = p1.lng * Math.PI / 180.0 - p2.lng * Math.PI / 180.0
  let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math
    .sin(b / 2), 2)))
  s = s * 6378.137
  s = Math.round(s * 10000) / 10000
  return s
}
/*获取当前页url*/
const getCurrentPageUrl=()=>{
  let pages = getCurrentPages()    //获取加载的页面
  let currentPage = pages[pages.length-1]    //获取当前页面的对象
  let url = currentPage.route    //当前页面url
  return url
}
/*获取当前页参数*/
const getCurrentPageParam=()=>{
  let pages = getCurrentPages()    //获取加载的页面
  let currentPage = pages[pages.length-1]    //获取当前页面的对象
  let options = currentPage.options    //如果要获取url中所带的参数可以查看options
  return options
}

module.exports = {
  formatTime: formatTime,
  formatLocation: formatLocation,
  isEmojiCharacter: isEmojiCharacter,
  checkNormalName: checkNormalName,
  messageAuth: messageAuth,
  dateUtils: dateUtils,
  objUtils: objUtils,
  strUtils: strUtils,
  rili: rili,
  positionXY: positionXY,
  getCurrentPageUrl,
  getCurrentPageParam
}
